var express = require('express');
var app = express();

const cors = require('cors')
app.use(cors())
 
// app.get('/hello', function (req, res) {
//   console.log(req.body)
//    res.send('Hello World');
// })

//路由
const goods_router = require('./router/goods')
const users_router = require('./router/users')
const order_router = require('./router/order')
const category_router = require('./router/category')
const params_router = require('./router/params')

//静态文件托管 ----  访问：http:localhost:8989/图片.jpg
// http:localhost:8989/1644933623332-1.png
app.use(express.static('server/upload'))

app.use('/',goods_router)
app.use('/',users_router)
app.use('/',order_router)
app.use('/',category_router)
app.use('/',params_router)

var server = app.listen(8989, function () {
  var port = server.address().port
  console.log("后台访问地址为 http://localhost:%s", port)
 
})